// Author: Domien Nowicki

#ifndef MAPLANDITEM_H
#define MAPLANDITEM_H

#include <QGraphicsItem>
#include "Land.h"
#include "MapProvinceItem.h"

class MapWidget;

class MapLandItem : public QObject, public QGraphicsItem, public Land
{
	Q_OBJECT
public:

	// Constructors
	MapLandItem(MapWidget *mapView, const std::string& name);
	MapLandItem(const MapLandItem& rhs);
	MapLandItem(MapWidget *mapView, const Land& rhs);

	// Destructors
	virtual ~MapLandItem();

	// Overloaded functions
	virtual Province* InsertNewProvince(const std::string& name);
	virtual Province* InsertNewProvince(const Province& rhs);



	// Qt overloaded functions
	QRectF boundingRect() const;
	QPainterPath shape() const;
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

signals:
	// Signal for when a parent has been added to the graphics scene
	void parentAddedToScene(QGraphicsScene*);
	void cursorChanged(const QCursor&);

public slots:
	// Add item to the graphics scene
	void AddToScene(QGraphicsScene *newScene, QGraphicsItem *item=0);
	// Set all province's cursor
	void SetCursor(const QCursor& cursor);


protected:
	// Overloaded operations
	virtual Province* InsertProvince(MapProvinceItem* province);

signals:
	void clickedProvince(Land*, Province*);
private slots:
	void slotClickedProvince(Province *province);

private:
	MapWidget *map;
	QRectF bounds;
	QPolygon poly;
	QPainterPath path;

	static const int LANDZ = 1;
};

#endif /*MAPLANDITEM_H*/
